package han.entity;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;

/**
 * @author: Han
 * @date: 2018/7/12 13:49
 * @dscription: 投资机构实体
 */
public class InvestCompanyInfoEntity {
    private long id;
    private String krId;
    private String name;
    private String fullName;
    private String intro;
    private String address;
    private String email;
    private String phoneNumber;
    private String member;
    private int m;
    private String website;
    private String industry;

    public InvestCompanyInfoEntity() {
    }

    public InvestCompanyInfoEntity(long id, String krId, String name, String fullName, String intro, String address, String email, String phoneNumber, String member) {
        this.id = id;
        this.krId = krId;
        this.name = name;
        this.fullName = fullName;
        this.intro = intro;
        this.address = address;
        this.email = email;
        this.phoneNumber = phoneNumber;
        this.member = member;
    }

    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

    public void setBasicInfo(InvestBasicEntity entity) {
        setAddress(entity.getAddress());
        setEmail(entity.getEmail());
        setPhoneNumber(entity.getPhone());
        setName(entity.getName());
        setFullName(entity.getFullName());
        setId(entity.getId());
        setIntro(entity.getIntro());
        setKrId(entity.getKrId());
        setWebsite(entity.getWebsite());
        setIndustry(entity.getIndustry());
    }

    public Map<String, String> generateMap() {
        Map<String, String> map = new LinkedHashMap<>();
        map.put("简称", name);
        map.put("全称", fullName);
        map.put("基本介绍", intro);
        map.put("公司地址", address);
        map.put("公司邮箱", email);
        map.put("电话", phoneNumber);
        map.put("联系人姓名", "-");
        map.put("头衔", "-");
        map.put("手机", "-");
        map.put("邮箱", "-");
        map.put("微信号", "-");
        if (Objects.isNull(member)) {
            member = "-";
        }
        member = member.replace("\n姓名", "abcdlalalaxxx");
        member = member.replaceAll("\n", "");
        member = member.replaceAll("abcdlalalaxxx", "\n姓名");
        String[] members = member.split("\n姓名:");
        for (int memIndex = 0; memIndex < members.length; memIndex++) {
            String mem = members[memIndex];
            mem = mem.replaceAll("\\s", "");
            String[] temp = mem.split(";");
            String name = "-";
            String title = "-";
            String intro = "-";
            try {
                name = temp[0];
                title = temp[1];
                intro = temp[2];
            } catch (ArrayIndexOutOfBoundsException ignore) {
            }
            int index = memIndex + 1;
            map.put("成员" + index, name.replace("姓名:", ""));
            map.put("头衔" + index, title.replace("头衔:", ""));
            map.put("履历" + index, intro.replace("简介:", ""));
        }

        return map;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getKrId() {
        return krId;
    }

    public void setKrId(String krId) {
        this.krId = krId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getMember() {
        return member;
    }

    public void setMember(String member) {
        this.member = member;
    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public String toString() {
        return "InvestCompanyInfoEntity{" + "id=" + id +
                ", krId='" + krId + '\'' +
                ", name='" + name + '\'' +
                ", fullName='" + fullName + '\'' +
                ", intro='" + intro + '\'' +
                ", address='" + address + '\'' +
                ", email='" + email + '\'' +
                ", phoneNumber='" + phoneNumber + '\'' +
                ", member='" + member + '\'' +
                '}';
    }

    public int getM() {
        return m;
    }

    public void setM(int m) {
        this.m = m;
    }

    public String getWebsite() {
        return website;
    }

    public void setWebsite(String website) {
        this.website = website;
    }

    public String getIndustry() {
        return industry;
    }

    public void setIndustry(String industry) {
        this.industry = industry;
    }
}
